\(\int (c+d x) (a+b \sec (e+f x)) \, dx\) [26]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 16, antiderivative size = 93 \[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\frac {a (c+d x)^2}{2 d}-\frac {2 i b (c+d x) \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {i b d \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {i b d \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2} \]

[Out]

1/2*a*(d*x+c)^2/d-2*I*b*(d*x+c)*arctan(exp(I*(f*x+e)))/f+I*b*d*polylog(2,-I*exp(I*(f*x+e)))/f^2-I*b*d*polylog(
2,I*exp(I*(f*x+e)))/f^2

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {4275, 4266, 2317, 2438} \[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\frac {a (c+d x)^2}{2 d}-\frac {2 i b (c+d x) \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {i b d \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {i b d \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2} \]

[In]

Int[(c + d*x)*(a + b*Sec[e + f*x]),x]

[Out]

(a*(c + d*x)^2)/(2*d) - ((2*I)*b*(c + d*x)*ArcTan[E^(I*(e + f*x))])/f + (I*b*d*PolyLog[2, (-I)*E^(I*(e + f*x))
])/f^2 - (I*b*d*PolyLog[2, I*E^(I*(e + f*x))])/f^2

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 4266

Int[csc[(e_.) + Pi*(k_.) + (f_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[-2*(c + d*x)^m*(ArcTanh[E
^(I*k*Pi)*E^(I*(e + f*x))]/f), x] + (-Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Log[1 - E^(I*k*Pi)*E^(I*(e + f*x))],
 x], x] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Log[1 + E^(I*k*Pi)*E^(I*(e + f*x))], x], x]) /; FreeQ[{c, d, e,
f}, x] && IntegerQ[2*k] && IGtQ[m, 0]

Rule 4275

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Csc[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = \int (a (c+d x)+b (c+d x) \sec (e+f x)) \, dx \\ & = \frac {a (c+d x)^2}{2 d}+b \int (c+d x) \sec (e+f x) \, dx \\ & = \frac {a (c+d x)^2}{2 d}-\frac {2 i b (c+d x) \arctan \left (e^{i (e+f x)}\right )}{f}-\frac {(b d) \int \log \left (1-i e^{i (e+f x)}\right ) \, dx}{f}+\frac {(b d) \int \log \left (1+i e^{i (e+f x)}\right ) \, dx}{f} \\ & = \frac {a (c+d x)^2}{2 d}-\frac {2 i b (c+d x) \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {(i b d) \text {Subst}\left (\int \frac {\log (1-i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^2}-\frac {(i b d) \text {Subst}\left (\int \frac {\log (1+i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^2} \\ & = \frac {a (c+d x)^2}{2 d}-\frac {2 i b (c+d x) \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {i b d \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {i b d \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.12 \[ \int (c+d x) (a+b \sec (e+f x)) \, dx=a c x+\frac {1}{2} a d x^2-\frac {2 i b d x \arctan \left (e^{i e+i f x}\right )}{f}+\frac {b c \text {arctanh}(\sin (e+f x))}{f}+\frac {i b d \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {i b d \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2} \]

[In]

Integrate[(c + d*x)*(a + b*Sec[e + f*x]),x]

[Out]

a*c*x + (a*d*x^2)/2 - ((2*I)*b*d*x*ArcTan[E^(I*e + I*f*x)])/f + (b*c*ArcTanh[Sin[e + f*x]])/f + (I*b*d*PolyLog
[2, (-I)*E^(I*(e + f*x))])/f^2 - (I*b*d*PolyLog[2, I*E^(I*(e + f*x))])/f^2

Maple [A] (verified)

Time = 0.30 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.53

method result size
parts \(a \left (\frac {1}{2} d \,x^{2}+x c \right )+\frac {b \left (\frac {d \left (-\left (f x +e \right ) \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )+\left (f x +e \right ) \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )+i \operatorname {dilog}\left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )-i \operatorname {dilog}\left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )\right )}{f}+c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )-\frac {e d \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}\right )}{f}\) \(142\)
derivativedivides \(\frac {a c \left (f x +e \right )-\frac {a d e \left (f x +e \right )}{f}+\frac {a d \left (f x +e \right )^{2}}{2 f}+b c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )-\frac {b d e \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}+\frac {b d \left (-\left (f x +e \right ) \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )+\left (f x +e \right ) \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )+i \operatorname {dilog}\left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )-i \operatorname {dilog}\left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )\right )}{f}}{f}\) \(166\)
default \(\frac {a c \left (f x +e \right )-\frac {a d e \left (f x +e \right )}{f}+\frac {a d \left (f x +e \right )^{2}}{2 f}+b c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )-\frac {b d e \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{f}+\frac {b d \left (-\left (f x +e \right ) \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )+\left (f x +e \right ) \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )+i \operatorname {dilog}\left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )-i \operatorname {dilog}\left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )\right )}{f}}{f}\) \(166\)
risch \(\frac {a d \,x^{2}}{2}+a x c -\frac {2 i b c \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}-\frac {b d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}-\frac {b d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}+\frac {b d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}+\frac {b d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}+\frac {i b d \operatorname {dilog}\left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {i b d \operatorname {dilog}\left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {2 i b d e \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}\) \(186\)

[In]

int((d*x+c)*(a+b*sec(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

a*(1/2*d*x^2+x*c)+b/f*(1/f*d*(-(f*x+e)*ln(1+I*exp(I*(f*x+e)))+(f*x+e)*ln(1-I*exp(I*(f*x+e)))+I*dilog(1+I*exp(I
*(f*x+e)))-I*dilog(1-I*exp(I*(f*x+e))))+c*ln(sec(f*x+e)+tan(f*x+e))-e/f*d*ln(sec(f*x+e)+tan(f*x+e)))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 343 vs. \(2 (73) = 146\).

Time = 0.27 (sec) , antiderivative size = 343, normalized size of antiderivative = 3.69 \[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\frac {a d f^{2} x^{2} + 2 \, a c f^{2} x - i \, b d {\rm Li}_2\left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) - i \, b d {\rm Li}_2\left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + i \, b d {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) + i \, b d {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) - {\left (b d e - b c f\right )} \log \left (\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) + {\left (b d e - b c f\right )} \log \left (\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right ) + {\left (b d f x + b d e\right )} \log \left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) - {\left (b d f x + b d e\right )} \log \left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) + {\left (b d f x + b d e\right )} \log \left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) - {\left (b d f x + b d e\right )} \log \left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) - {\left (b d e - b c f\right )} \log \left (-\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) + {\left (b d e - b c f\right )} \log \left (-\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right )}{2 \, f^{2}} \]

[In]

integrate((d*x+c)*(a+b*sec(f*x+e)),x, algorithm="fricas")

[Out]

1/2*(a*d*f^2*x^2 + 2*a*c*f^2*x - I*b*d*dilog(I*cos(f*x + e) + sin(f*x + e)) - I*b*d*dilog(I*cos(f*x + e) - sin
(f*x + e)) + I*b*d*dilog(-I*cos(f*x + e) + sin(f*x + e)) + I*b*d*dilog(-I*cos(f*x + e) - sin(f*x + e)) - (b*d*
e - b*c*f)*log(cos(f*x + e) + I*sin(f*x + e) + I) + (b*d*e - b*c*f)*log(cos(f*x + e) - I*sin(f*x + e) + I) + (
b*d*f*x + b*d*e)*log(I*cos(f*x + e) + sin(f*x + e) + 1) - (b*d*f*x + b*d*e)*log(I*cos(f*x + e) - sin(f*x + e)
+ 1) + (b*d*f*x + b*d*e)*log(-I*cos(f*x + e) + sin(f*x + e) + 1) - (b*d*f*x + b*d*e)*log(-I*cos(f*x + e) - sin
(f*x + e) + 1) - (b*d*e - b*c*f)*log(-cos(f*x + e) + I*sin(f*x + e) + I) + (b*d*e - b*c*f)*log(-cos(f*x + e) -
 I*sin(f*x + e) + I))/f^2

Sympy [F]

\[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\int \left (a + b \sec {\left (e + f x \right )}\right ) \left (c + d x\right )\, dx \]

[In]

integrate((d*x+c)*(a+b*sec(f*x+e)),x)

[Out]

Integral((a + b*sec(e + f*x))*(c + d*x), x)

Maxima [F]

\[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\int { {\left (d x + c\right )} {\left (b \sec \left (f x + e\right ) + a\right )} \,d x } \]

[In]

integrate((d*x+c)*(a+b*sec(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(a*d*f*x^2 + 2*a*c*f*x + 4*b*d*f*integrate((x*cos(2*f*x + 2*e)*cos(f*x + e) + x*sin(2*f*x + 2*e)*sin(f*x +
 e) + x*cos(f*x + e))/(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1), x) + b*c*log(cos(f*x
 + e)^2 + sin(f*x + e)^2 + 2*sin(f*x + e) + 1) - b*c*log(cos(f*x + e)^2 + sin(f*x + e)^2 - 2*sin(f*x + e) + 1)
)/f

Giac [F]

\[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\int { {\left (d x + c\right )} {\left (b \sec \left (f x + e\right ) + a\right )} \,d x } \]

[In]

integrate((d*x+c)*(a+b*sec(f*x+e)),x, algorithm="giac")

[Out]

integrate((d*x + c)*(b*sec(f*x + e) + a), x)

Mupad [F(-1)]

Timed out. \[ \int (c+d x) (a+b \sec (e+f x)) \, dx=\int \left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )\,\left (c+d\,x\right ) \,d x \]

[In]

int((a + b/cos(e + f*x))*(c + d*x),x)

[Out]

int((a + b/cos(e + f*x))*(c + d*x), x)